import { useTypedDispatch } from "@store/index";
import { addGuestChannel } from "@slice/guestChannel";

interface Props {
    // 频道对象
    channel: Channel;
  }

export default function Item({ channel }: Props) {
    // 获取 dispatch 方法
  const dispatch = useTypedDispatch();
    return  <span
    onClick={() => {
      dispatch(addGuestChannel(channel));
    }}
  >
    + {channel.name}
  </span>
  
  }